{extend name="ace/layout/default" /}

{block name="title"}管理员日志管理{/block}

{block name="content"}
<h3 class="header smaller lighter blue">
    管理员日志列表
    <small>
        <i class="icon-double-angle-right"></i>
        Administrator log list
    </small>
</h3>
<div class="row">
    <div class="col-xs-12 col-sm-12 col-ml-12">
        <a href="javascript:;" onclick="batchDelOperation('{:url(\'delete\')}');">
            <button type="button" class="btn btn-sm btn-danger">
                <i class="icon-trash bigger-120"></i>
                批量删除
            </button>
        </a>
        <a href="javascript:;" onclick="batchExport('{:url(\'export\')}');">
            <button class="btn btn-sm btn-info">
                <i class="icon icon-cloud-download bigger-120"></i>
                导出
            </button>
        </a>
    </div>
    <div class="col-xs-12 col-sm-12 col-ml-12">
        <div class="space-4"></div>
        <form action="" method="get" id="form_data" class="first_form float-left">
            <?php $search_month = input('search_month', date('Y-m')); ?>
            <select name="search_month">
                <option value="{date('Y-m')}" {$search_month == date('Y-m') ? 'selected' : ''}> 请选择指定月份的日志 </option>
                {if !empty($all_monthes)}
                    {foreach $all_monthes as $month}
                        <option value="{$month}" {$search_month == $month ? 'selected' : ''}> {$month} 的日志 </option>
                    {/foreach}
                {/if}
            </select>
            <?php $admin_id = input('admin_id', -1); ?>
            <select name="admin_id">
                <option value="-1" {$admin_id == -1 ? 'selected' : ''}> 请选择管理员 </option>
                {if !empty($admins)}
                    {foreach $admins as $admin}
                        <option value="{$admin->admin_id}" {$admin_id == $admin->admin_id ? 'selected' : ''}> {$admin->admin_name} </option>
                    {/foreach}
                {/if}
            </select>
            <span class="input-icon">
                <button type="button" class="btn btn-purple btn-sm" onclick="$('form.first_form').submit();">
                    Search
                    <i class="icon-search icon-on-right bigger-110"></i>
                </button>
            </span>
        </form>
    </div>
</div>
<div class="space-4"></div>
<div class="table-header">Administrator log list</div>
<div class="table-responsive">
    <table id="sample-table-1" class="table table-striped table-bordered table-hover">
        <thead>
        <tr>
            <th class="center">
                <label>
                    <input type="checkbox" class="ace" name="log_id[]" />
                    <span class="lbl"></span>
                </label>
            </th>
            <th class="text-center"> Id </th>
            <th class="text-center"> 管理员 </th>
            <th class="text-center"> 请求地址 </th>
            <th class="text-center"> 请求方式 </th>
            <th class="text-center hidden-sm hidden-xs"> 描述 </th>
            <th class="text-center hidden-sm hidden-xs"> 操作Ip </th>
            <th class="text-center hidden-sm hidden-xs hidden-md"> 操作时间 </th>
            <th class="text-center"> 操作 </th>
        </tr>
        </thead>
        <tbody>
        {if !empty($list) && $list->total()}
        {foreach $list as $key => $item}
        <tr id="id_{$item->log_id}" name="{$item->admin->admin_name ?? ''}">
            <td class="text-center">
                <label>
                    <input type="checkbox" class="ace" name="log_id[]" value="{$item->log_id}" />
                    <span class="lbl"></span>
                </label>
            </td>
            <td class="text-center"> <a href="javascript:;">{$item->log_id}</a> </td>
            <td class="text-center"> {$item->admin->admin_name ?? ''} </td>
            <td class="text-center"> {$item->log_action} </td>
            <td class="text-center"> {$item->log_method} </td>
            <td class="text-center hidden-sm hidden-xs"> {$item->description} </td>
            <td class="text-center hidden-sm hidden-xs"> {$item->created_ip} </td>
            <td class="text-center hidden-sm hidden-xs hidden-md">
                {:date('Y-m-d H:i', $item->created_time)}
            </td>
            <td class="text-center">
                <a class="btn btn-xs btn-danger" title="删除操作日志" onclick="delOperation({$item->log_id}, '{:url(\'delete\')}', '{:date(\'Y-m\', $item->created_time)}')">
                    <i class="icon-trash bigger-120"></i> 删除
                </a>
            </td>
        </tr>
        {/foreach}
        {/if}
        </tbody>
    </table>

    <div class="hr hr-18 dotted hr-double"></div>

    {if !empty($list) && $list->total()}
    <div id="pageList" class="float-right">
        {$list|raw}
    </div>
    {/if}
</div><!-- /.table-responsive -->
{/block}